% Figure 7
% Credit card issuer profitability ratios
% This figure plots the annual estimates of the return on assets for large
% U.S. credit card banks reported by the Federal Reserve Board.

clear; clc;

%Source: Table 1. Return on assets, large U.S. credit card banks, 2001–19, Percent
%https://www.federalreserve.gov/publications/credit-card-profitability.htm
%Note: Credit card banks are commercial banks with average assets greater than
% or equal to $200 million, with a minimum 50 percent of assets in consumer
% lending and 90 percent of consumer lending in the form of revolving credit.
% Profitability of credit card banks is measured as net pretax income as
% a percentage of average quarterly assets.
% Source: Federal Financial Institutions Examination Council, Consolidated Reports
% of Condition and Income (Call Reports), https://www.ffiec.gov/.
Year = [2001;2002;2003;2004;2005;2006;2007;2008;2009;2010;2011;2012;2013;2014;2015;2016;2017;2018;2019];
Return = [4.83;6.06;6.73;6.3;4.4;7.65;5.08;2.6;-5.33;2.41;5.37;4.8;5.2;4.94;4.36;4.04;3.37;3.79;4.14];

Dates = repmat(datetime(2020,1,1),length(Year),1);
for i=1:length(Year)
   Dates(i,1) = datetime(Year(i),12,31); 
end


plotData = timetable(Return,'RowTimes',Dates);
plotData.Properties.DimensionNames(1) = "Date";

fig1 = figure('NumberTitle', 'Off', 'Name', 'Figure 1');

letterWidth_inches = 8.5;
letterHeight_inches = 11.0;
letterWidth_cm = 21.59;
letterHeight_cm = 27.94;
letterWidth_pixel = 2250;
letterHeight_pixel = 3300;

paperWidth  = letterWidth_cm;
paperHeight = letterHeight_cm;
leftMargin = 1;
bottomMargin  = 1;
figOrientation = 'portrait';
figWidth = 18;
figHeight = 12;

set(fig1,'Units','centimeters');
set(fig1,'Position',[0 0 figWidth figHeight]);
movegui(fig1,'center')

set(fig1,'PaperUnits', 'centimeters');
set(fig1,'PaperSize', [paperWidth paperHeight]);
set(fig1,'PaperPosition',[leftMargin bottomMargin figWidth figHeight]);
set(fig1,'PaperSize', [figWidth figHeight]);
set(fig1,'PaperPosition',[0 0 figWidth figHeight]);
set(fig1,'PaperOrientation',figOrientation);
set(fig1,'InvertHardcopy','on');


plot_1 = plot(datenum(plotData.Date),plotData.Return);
set(plot_1, 'LineStyle', '-', 'Color', 'b' , 'LineWidth', 1.00);
hold on
plot_2 = plot(datenum(plotData.Date),zeros(length(plotData.Date)));
set(plot_2, 'LineStyle', '-', 'Color', [17 17 17]./255 , 'LineWidth', .05);
ax = gca;
ax.PlotBoxAspectRatio = [1,0.35,0.35];
ylim([0 35])
ylim([-10 10])

minX = min(datenum(plotData.Date));
maxX = max(datenum(plotData.Date));
xlim([minX-0.25 maxX+0.025])
dateaxis
set(gca,'XTick',datenum([...
    'Jan-1-2002'; ...
    'Jan-1-2006'; ...
    'Jan-1-2010'; ...
    'Jan-1-2014'; ...
    'Jan-1-2018']));
set(gca,'XTickLabel',[...
    '2002';...
    '2006';...
    '2010';...
    '2014';...
    '2018'])
set(gca,'YTick',[-10;-8;-6;-4;-2;0;2;4;6;8;10]);
ylabel('Percent')
grid 'on';
box 'on';
set(gcf, 'Color', [1,1,1]);

